<!DOCTYPE html>
<html lang="">
  <head>
    
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>


<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<meta name="theme-color" content="#f8f5ec" />
<meta name="msapplication-navbutton-color" content="#f8f5ec">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec">



  <meta name="description" content="使用Gitee+Hexo搭建个人博客"/>




  <meta name="keywords" content="程序员, IT, 互联网, 技术, 博客" />










  <link rel="alternate" href="/blog/default" title="咻咻ing">




  <link rel="shortcut icon" type="image/x-icon" href="/blog/favicon.ico?v=2.9.0" />



<link rel="canonical" href="https://xiuxiuing.gitee.io/blog/2018/08/08/giteepage/"/>



  <link rel="stylesheet" type="text/css" href="/blog/lib/fancybox/jquery.fancybox.css" />




  <link rel="stylesheet" type="text/css" href="/blog/lib/nprogress/nprogress.min.css" />



<link rel="stylesheet" type="text/css" href="/blog/css/style.css?v=2.9.0" />



  
  <script id="baidu_analytics">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?6f2041754dc216e6973762726c19d178";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <script id="baidu_push">
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>





  <script src="//cdn1.lncld.net/static/js/3.1.1/av-min.js"></script>
  <script id="leancloud">
    AV.init({
      appId: "CPWqXTBOMHfb978mUUhzNGl5-gzGzoHsz",
      appKey: "NacrB6AlMs6sf7SS5lebu9ln"
    });
  </script>
  <script src="https://c.mipcdn.com/extensions/platform/v1/mip-cambrian/mip-cambrian.js"></script>
            



<script>
  window.config = {"title":"咻咻ing","subtitle":"欢迎关注公众号：咻咻ing","description":"记录一个程序猿的成长历程","author":"xiuxiuing","language":null,"timezone":null,"url":"https://xiuxiuing.gitee.io/blog","root":"/blog/","permalink":":year/:month/:day/:title/","permalink_defaults":null,"source_dir":"source","public_dir":"public","tag_dir":"tags","archive_dir":"archives","category_dir":"categories","code_dir":"downloads/code","i18n_dir":":lang","skip_render":null,"new_post_name":":title.md","default_layout":"post","titlecase":false,"external_link":true,"filename_case":0,"render_drafts":false,"post_asset_folder":true,"relative_link":false,"future":true,"highlight":{"enable":true,"auto_detect":false,"line_number":true,"tab_replace":null},"default_category":"uncategorized","category_map":"cat","tag_map":"tag","date_format":"YYYY-MM-DD","time_format":"HH:mm:ss","per_page":10,"pagination_dir":"page","theme":"even","deploy":{"type":"git","repo":"https://gitee.com/xiuxiuing/blog.git","branch":"master"},"ignore":[],"keywords":"程序员, IT, 互联网, 技术, 博客","index_generator":{"per_page":10,"order_by":"-date","path":""},"archive_generator":{"per_page":10,"yearly":true,"monthly":true,"daily":false},"category_generator":{"per_page":10},"tag_generator":{"per_page":10},"marked":{"gfm":true,"pedantic":false,"sanitize":false,"tables":true,"breaks":true,"smartLists":true,"smartypants":true,"modifyAnchors":"","autolink":true},"server":{"port":4000,"log":false,"ip":"0.0.0.0","compress":false,"header":true},"since":2015,"favicon":"/favicon.ico","rss":"default","menu":{"Home":"/","Archives":"/archives/","Tags":"/tags","Categories":"/categories","About":"/about"},"color":"Default","search":true,"toc":true,"fancybox":true,"pjax":true,"copyright":{"enable":true,"license":"<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\" target=\"_blank\">知识共享署名-非商业性使用 4.0 国际许可协议</a>"},"reward":{"enable":true,"qrCode":{"wechat":"http://pd59y0agg.bkt.clouddn.com/%E8%B5%9E%E8%B5%8F.png","alipay":null}},"social":{"email":"xiuxiuing@yeah.net","stack-overflow":null,"twitter":null,"facebook":null,"linkedin":null,"google":null,"github":"https://gitee.com/xiuxiuing/blog","weibo":null,"zhihu":null,"douban":null,"pocket":null,"tumblr":null,"instagram":null},"leancloud":{"app_id":"CPWqXTBOMHfb978mUUhzNGl5-gzGzoHsz","app_key":"NacrB6AlMs6sf7SS5lebu9ln"},"baidu_analytics":"6f2041754dc216e6973762726c19d178","baidu_verification":null,"google_analytics":null,"google_verification":null,"disqus_shortname":null,"changyan":{"appid":null,"appkey":null},"livere_datauid":"MTAyMC8zOTA3MC8xNTU5Nw==","version":"2.9.0"};
</script>

    <title> 使用Gitee+Hexo搭建个人博客 - 咻咻ing </title>
  </head>

  <body><div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/blog/." class="logo">咻咻ing</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>

<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    
      <a href="/blog/">
        <li class="mobile-menu-item">
          
          
            首页
          
        </li>
      </a>
    
      <a href="/blog/archives/">
        <li class="mobile-menu-item">
          
          
            归档
          
        </li>
      </a>
    
      <a href="/blog/tags">
        <li class="mobile-menu-item">
          
          
            标签
          
        </li>
      </a>
    
      <a href="/blog/categories">
        <li class="mobile-menu-item">
          
          
            分类
          
        </li>
      </a>
    
      <a href="/blog/about">
        <li class="mobile-menu-item">
          
          
            关于
          
        </li>
      </a>
    
  </ul>
</nav>

    <div class="container" id="mobile-panel">
      <header id="header" class="header"><div class="logo-wrapper">
  <a href="/blog/." class="logo">咻咻ing</a>
</div>

<nav class="site-navbar">
  
    <ul id="menu" class="menu">
      
        <li class="menu-item">
          <a class="menu-item-link" href="/blog/">
            
            
              首页
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/blog/archives/">
            
            
              归档
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/blog/tags">
            
            
              标签
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/blog/categories">
            
            
              分类
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/blog/about">
            
            
              关于
            
          </a>
        </li>
      
    </ul>
  
</nav>

      </header>

      <main id="main" class="main">
        <div class="content-wrapper">
          <div id="content" class="content">
            
  
  <article class="post">
    <header class="post-header">
      <h1 class="post-title">
        
          使用Gitee+Hexo搭建个人博客
        
      </h1>

      <div class="post-meta">
        <span class="post-time">
          2018-08-08
        </span>
        
          <div class="post-category">
            
              <a href="/blog/categories/博客搭建/">博客搭建</a>
            
          </div>
        
        
        <div class="post-visits"
             data-url="/blog/2018/08/08/giteepage/"
             data-title="使用Gitee+Hexo搭建个人博客">
            阅读次数 0
          </div>
        
      </div>
    </header>

    
    
  <div class="post-toc" id="post-toc">
    <h2 class="post-toc-title">文章目录</h2>
    <div class="post-toc-content">
      <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#为何使用Gitee而不是GitHub"><span class="toc-text">为何使用Gitee而不是GitHub</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#环境要求"><span class="toc-text">环境要求</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#开始搭建"><span class="toc-text">开始搭建</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-安装Hexo"><span class="toc-text">1. 安装Hexo</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-初始化Hexo"><span class="toc-text">2. 初始化Hexo</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-获取博客主题"><span class="toc-text">3. 获取博客主题</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-config-yml对博客进行基础配置"><span class="toc-text">4. _config.yml对博客进行基础配置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-本地预览博客"><span class="toc-text">5. 本地预览博客</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#部署博客到Gitee上"><span class="toc-text">部署博客到Gitee上</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-创建Gitee账号"><span class="toc-text">1. 创建Gitee账号</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-创建项目"><span class="toc-text">2. 创建项目</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-在-config-yml中配置Git"><span class="toc-text">3. 在_config.yml中配置Git</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-发布到Gitee"><span class="toc-text">4. 发布到Gitee</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-Gitee-Pages设置"><span class="toc-text">5. Gitee Pages设置</span></a></li></ol></li></ol>
    </div>
  </div>



    <div class="post-content">
      
        <h3 id="为何使用Gitee而不是GitHub"><a href="#为何使用Gitee而不是GitHub" class="headerlink" title="为何使用Gitee而不是GitHub"></a>为何使用Gitee而不是GitHub</h3><p>目前国内访问GitHub速度慢，还可能被墙，所以Gitee来构建个人博客。Gitee类似国内版的GitHub，访问速度有保证。<br><a id="more"></a></p>
<h3 id="环境要求"><a href="#环境要求" class="headerlink" title="环境要求"></a>环境要求</h3><ul>
<li>Git  </li>
<li>NodeJs<br>默认你已经安装了Git  和 NodeJS (推荐使用cnpm)<br>传送门：(<a href="https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00137396287703354d8c6c01c904c7d9ff056ae23da865a000" target="_blank" rel="noopener">Git安装教程</a>) (<a href="https://www.runoob.com/nodejs/nodejs-install-setup.html" target="_blank" rel="noopener">Nodejs安装教程</a>) (<a href="https://xiuxiuing.gitee.io/blog/2018/08/25/cnpm/">cnpm使用教程</a>)</li>
</ul>
<h3 id="开始搭建"><a href="#开始搭建" class="headerlink" title="开始搭建"></a>开始搭建</h3><h4 id="1-安装Hexo"><a href="#1-安装Hexo" class="headerlink" title="1. 安装Hexo"></a>1. 安装Hexo</h4><pre><code>打开 shell 终端，输入命令`npm install -g hexo`
</code></pre> <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br></pre></td><td class="code"><pre><span class="line">$ sudo cnpm install -g hexo</span><br><span class="line">Password:</span><br><span class="line">Downloading hexo to /usr/local/lib/node_modules/hexo_tmp</span><br><span class="line">Copying /usr/local/lib/node_modules/hexo_tmp/_hexo@3.7.1@hexo to /usr/local/lib/node_modules/hexo</span><br><span class="line">Installing hexo&apos;s dependencies to /usr/local/lib/node_modules/hexo/node_modules</span><br><span class="line">[1/27] abbrev@^1.0.7 installed at node_modules/_abbrev@1.1.1@abbrev</span><br><span class="line">[2/27] archy@^1.0.0 installed at node_modules/_archy@1.0.0@archy</span><br><span class="line">[3/27] hexo-i18n@^0.2.1 installed at node_modules/_hexo-i18n@0.2.1@hexo-i18n</span><br><span class="line">[4/27] js-yaml@^3.6.1 existed at node_modules/_js-yaml@3.12.0@js-yaml</span><br><span class="line">[5/27] bluebird@^3.4.0 installed at node_modules/_bluebird@3.5.1@bluebird</span><br><span class="line">[6/27] chalk@^2.3.1 installed at node_modules/_chalk@2.4.1@chalk</span><br><span class="line">[7/27] hexo-front-matter@^0.2.2 installed at node_modules/_hexo-front-matter@0.2.3@hexo-front-matter</span><br><span class="line">[8/27] minimatch@^3.0.4 installed at node_modules/_minimatch@3.0.4@minimatch</span><br><span class="line">[9/27] pretty-hrtime@^1.0.2 installed at node_modules/_pretty-hrtime@1.0.3@pretty-hrtime</span><br><span class="line">[10/27] hexo-util@^0.6.3 installed at node_modules/_hexo-util@0.6.3@hexo-util</span><br><span class="line">[11/27] hexo-cli@^1.1.0 installed at node_modules/_hexo-cli@1.1.0@hexo-cli</span><br><span class="line">[12/27] resolve@^1.5.0 installed at node_modules/_resolve@1.8.1@resolve</span><br><span class="line">[13/27] strip-indent@^2.0.0 installed at node_modules/_strip-indent@2.0.0@strip-indent</span><br><span class="line">[14/27] strip-ansi@^4.0.0 installed at node_modules/_strip-ansi@4.0.0@strip-ansi</span><br><span class="line">[15/27] text-table@^0.2.0 installed at node_modules/_text-table@0.2.0@text-table</span><br><span class="line">[16/27] tildify@^1.2.0 existed at node_modules/_tildify@1.2.0@tildify</span><br><span class="line">[17/27] titlecase@^1.1.2 installed at node_modules/_titlecase@1.1.2@titlecase</span><br><span class="line">[18/27] moment@^2.19.4 installed at node_modules/_moment@2.22.2@moment</span><br><span class="line">[19/27] moment-timezone@^0.5.14 installed at node_modules/_moment-timezone@0.5.21@moment-timezone</span><br><span class="line">[20/27] hexo-log@^0.2.0 installed at node_modules/_hexo-log@0.2.0@hexo-log</span><br><span class="line">[21/27] swig-extras@0.0.1 installed at node_modules/_swig-extras@0.0.1@swig-extras</span><br><span class="line">[22/27] lodash@^4.17.5 installed at node_modules/_lodash@4.17.10@lodash</span><br><span class="line">[23/27] cheerio@0.22.0 installed at node_modules/_cheerio@0.22.0@cheerio</span><br><span class="line">fsevents@1.2.4 download from binary mirror: &#123;&quot;module_name&quot;:&quot;fse&quot;,&quot;module_path&quot;:&quot;./lib/binding/&#123;configuration&#125;/&#123;node_abi&#125;-&#123;platform&#125;-&#123;arch&#125;/&quot;,&quot;remote_path&quot;:&quot;./v&#123;version&#125;/&quot;,&quot;package_name&quot;:&quot;&#123;module_name&#125;-v&#123;version&#125;-&#123;node_abi&#125;-&#123;platform&#125;-&#123;arch&#125;.tar.gz&quot;,&quot;host&quot;:&quot;https://cdn.npm.taobao.org/dist/fsevents&quot;&#125;</span><br><span class="line">[24/27] nunjucks@^3.1.2 installed at node_modules/_nunjucks@3.1.3@nunjucks</span><br><span class="line">[25/27] swig-templates@^2.0.2 installed at node_modules/_swig-templates@2.0.2@swig-templates</span><br><span class="line">[26/27] hexo-fs@^0.2.0 installed at node_modules/_hexo-fs@0.2.3@hexo-fs</span><br><span class="line">[27/27] warehouse@^2.2.0 installed at node_modules/_warehouse@2.2.0@warehouse</span><br><span class="line">execute post install 2 scripts...</span><br><span class="line">[1/2] scripts.postinstall nunjucks@^3.1.2 run &quot;node postinstall-build.js src&quot;</span><br><span class="line">[1/2] scripts.postinstall nunjucks@^3.1.2 finished in 109ms</span><br><span class="line">[2/2] scripts.install hexo-fs@0.2.3 › chokidar@1.7.0 › fsevents@^1.0.0 run &quot;node install&quot;</span><br><span class="line">[fsevents] Success: &quot;/usr/local/lib/node_modules/hexo/node_modules/_fsevents@1.2.4@fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node&quot; already installed</span><br><span class="line">Pass --update-binary to reinstall or --build-from-source to recompile</span><br><span class="line">[2/2] scripts.install hexo-fs@0.2.3 › chokidar@1.7.0 › fsevents@^1.0.0 finished in 306ms</span><br><span class="line">deprecate titlecase@^1.1.2 no longer maintained</span><br><span class="line">Recently updated (since 2018-08-01): 1 packages (detail see file /usr/local/lib/node_modules/hexo/node_modules/.recently_updates.txt)</span><br><span class="line">  2018-08-06</span><br><span class="line">    → resolve@1.8.1 › path-parse@^1.0.5(1.0.6) (14:32:36)</span><br><span class="line">All packages installed (280 packages installed from npm registry, used 4s, speed 1.65MB/s, json 236(1.51MB), tarball 5.8MB)</span><br><span class="line">[hexo@3.7.1] link /usr/local/bin/hexo@ -&gt; /usr/local/lib/node_modules/hexo/bin/hexo</span><br></pre></td></tr></table></figure>
<p>注：如果提示权限错误，命令前加<code>sudo</code>,<code>cnpm</code> 是淘宝的开源镜像，国内访问比<code>npm</code>快。</p>
<h4 id="2-初始化Hexo"><a href="#2-初始化Hexo" class="headerlink" title="2. 初始化Hexo"></a>2. 初始化Hexo</h4><p>在你的电脑上创建<code>Hexo</code>文件夹，在shell终端中切换到<code>Hexo</code>目录，输入命令 <code>hexo init</code><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">$ cd /work/Hexo</span><br><span class="line">/work/Hexo $ hexo init</span><br><span class="line">INFO  Cloning hexo-starter to /work/Hexo</span><br><span class="line">Cloning into &apos;/work/Hexo&apos;...</span><br><span class="line">remote: Counting objects: 65, done.</span><br><span class="line">remote: Total 65 (delta 0), reused 0 (delta 0), pack-reused 65</span><br><span class="line">Unpacking objects: 100% (65/65), done.</span><br><span class="line">Submodule &apos;themes/landscape&apos; (https://github.com/hexojs/hexo-theme-landscape.git) registered for path &apos;themes/landscape&apos;</span><br><span class="line">Cloning into &apos;/work/Hexo/themes/landscape&apos;...</span><br><span class="line">^Cwarning: Clone succeeded, but checkout failed.</span><br><span class="line">You can inspect what was checked out with &apos;git status&apos;</span><br><span class="line">and retry the checkout with &apos;git checkout -f HEAD&apos;</span><br><span class="line"></span><br><span class="line">INFO  See you again</span><br></pre></td></tr></table></figure></p>
<p>初始化完成后<code>Hexo</code>的目录结构：<br><img src="http://pd59y0agg.bkt.clouddn.com/gitee1.png" alt="初始化后目录结构"></p>
<h4 id="3-获取博客主题"><a href="#3-获取博客主题" class="headerlink" title="3. 获取博客主题"></a>3. 获取博客主题</h4><p>安装样式解析：<code>npm install hexo-renderer-scss --save</code><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-renderer-scss --save</span><br><span class="line"></span><br><span class="line">&gt; node-sass@4.9.3 install /Users/wang/HexoNew/node_modules/node-sass</span><br><span class="line">&gt; node scripts/install.js</span><br><span class="line"></span><br><span class="line">Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/darwin-x64-64_binding.node</span><br><span class="line">Download complete ░⸩ ⠋ :</span><br><span class="line">Binary saved to /Users/wang/HexoNew/node_modules/node-sass/vendor/darwin-x64-64/binding.node</span><br><span class="line">Caching binary to /Users/wang/.npm/node-sass/4.9.3/darwin-x64-64_binding.node</span><br><span class="line"></span><br><span class="line">&gt; node-sass@4.9.3 postinstall /Users/wang/HexoNew/node_modules/node-sass</span><br><span class="line">&gt; node scripts/build.js</span><br><span class="line"></span><br><span class="line">Binary found at /Users/wang/HexoNew/node_modules/node-sass/vendor/darwin-x64-64/binding.node</span><br><span class="line">Testing binary</span><br><span class="line">Binary is fine</span><br><span class="line">+ hexo-renderer-scss@1.2.0</span><br><span class="line">added 187 packages from 167 contributors and audited 3576 packages in 24.221s</span><br><span class="line">found 0 vulnerabilities</span><br></pre></td></tr></table></figure></p>
<p>克隆主题：<code>git clone https://gitee.com/xiuxiuing/hexo-theme-even themes/even</code><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">/work/Hexo $ git clone https://gitee.com/xiuxiuing/hexo-theme-even themes/even</span><br><span class="line">Cloning into &apos;themes/even&apos;...</span><br><span class="line">remote: Counting objects: 136, done.</span><br><span class="line">remote: Compressing objects: 100% (123/123), done.</span><br><span class="line">remote: Total 136 (delta 4), reused 128 (delta 2)</span><br><span class="line">Receiving objects: 100% (136/136), 264.27 KiB | 556.00 KiB/s, done.</span><br><span class="line">Resolving deltas: 100% (4/4), done.</span><br></pre></td></tr></table></figure></p>
<p>克隆完成后，在<code>/Hexo/themes</code>目录下，可以看到 <code>landscape</code>和<code>even</code> 两个文件夹。<br>我们所要使用的主题都是放在这个目录下，Hexo默认使用的是<code>landscape</code>主题，由于第二步Hexo初始化时主题没有clone成功，所以我们这一步克隆了<code>even</code>主题，接下来会使用<code>even</code>主题进行演示。<br>想获取更多主题，可在网站：<a href="https://hexo.io/themes/" target="_blank" rel="noopener">https://hexo.io/themes/</a> 选择自己喜欢的主题，按照此步的步骤clone下来。</p>
<h4 id="4-config-yml对博客进行基础配置"><a href="#4-config-yml对博客进行基础配置" class="headerlink" title="4. _config.yml对博客进行基础配置"></a>4. _config.yml对博客进行基础配置</h4><p>_config.yml文件修改，保存<br><img src="http://pd59y0agg.bkt.clouddn.com/giteepage2.png" alt="_config.yml"></p>
<h4 id="5-本地预览博客"><a href="#5-本地预览博客" class="headerlink" title="5. 本地预览博客"></a>5. 本地预览博客</h4><p>编译项目，输入命令：<code>hexo g</code><br>运行项目，输入命令：<code>hexo s</code><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">$ hexo g</span><br><span class="line">INFO  Start processing</span><br><span class="line">INFO  Files loaded in 186 ms</span><br><span class="line">INFO  Generated: archives/2018/08/index.html</span><br><span class="line">INFO  Generated: archives/index.html</span><br><span class="line">INFO  Generated: archives/2018/index.html</span><br><span class="line">INFO  Generated: index.html</span><br><span class="line">INFO  Generated: 2018/08/08/hello-world/index.html</span><br><span class="line">INFO  5 files generated in 242 ms</span><br><span class="line">$ hexo s</span><br><span class="line">INFO  Start processing</span><br><span class="line">INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.</span><br></pre></td></tr></table></figure></p>
<p>在浏览器中输入<code>http://localhost:4000/`</code>就可以看到效果啦</p>
<h3 id="部署博客到Gitee上"><a href="#部署博客到Gitee上" class="headerlink" title="部署博客到Gitee上"></a>部署博客到Gitee上</h3><h4 id="1-创建Gitee账号"><a href="#1-创建Gitee账号" class="headerlink" title="1. 创建Gitee账号"></a>1. 创建Gitee账号</h4><p>到码云：<a href="https://gitee.com/" target="_blank" rel="noopener">https://gitee.com/</a> 上申请注册账号，码云类似国内版的GitHub，所以操作界面跟GitHub差不多，多了一些国产化的东西，这里不做更多介绍了，自己研究下。</p>
<h4 id="2-创建项目"><a href="#2-创建项目" class="headerlink" title="2. 创建项目"></a>2. 创建项目</h4><p><img src="http://pd59y0agg.bkt.clouddn.com/giteepage3.jpg" alt="创建项目"><br>创建完成后，在项目中复制项目地址。</p>
<h4 id="3-在-config-yml中配置Git"><a href="#3-在-config-yml中配置Git" class="headerlink" title="3. 在_config.yml中配置Git"></a>3. 在_config.yml中配置Git</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: https://gitee.com/xiuxiuing/blog.git</span><br><span class="line">  branch: master</span><br></pre></td></tr></table></figure>
<p>注意：冒号后面一定要有空格，否则不能正确识别。</p>
<h4 id="4-发布到Gitee"><a href="#4-发布到Gitee" class="headerlink" title="4. 发布到Gitee"></a>4. 发布到Gitee</h4><p>输入命令<code>npm install hexo-deployer-git  --save</code> 安装自动部署发布工具<br>输入命令<code>hexo clean &amp;&amp; hexo g &amp;&amp; hexo d</code> 发布博客，首次发布需要在shell中输入账号和密码。</p>
<h4 id="5-Gitee-Pages设置"><a href="#5-Gitee-Pages设置" class="headerlink" title="5. Gitee Pages设置"></a>5. Gitee Pages设置</h4><p>在项目的服务中选择Pages选项<br><img src="http://pd59y0agg.bkt.clouddn.com/giteepage4.png" alt="Pages"><br>选择 master分支，点击 部署/更新<br><img src="http://pd59y0agg.bkt.clouddn.com/giteepage5.jpg" alt="部署"><br>稍等一会儿博客就发布成功啦，访问博客地址：<a href="https://xiuxiuing.gitee.io/blog，就可预览在线博客啦！！！">https://xiuxiuing.gitee.io/blog，就可预览在线博客啦！！！</a><br>如果博客的样式不对，则需要在_config.yml中配置下博客地址和路径：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">url: https://xiuxiuing.gitee.io/blog/</span><br><span class="line">root: /blog</span><br></pre></td></tr></table></figure></p>
<p>再执行命令<code>hexo clean &amp;&amp; hexo g &amp;&amp; hexo d</code> 就可以啦。</p>
<p>至此，我们的博客就搭建完成啦！！！<br>在<code>/Hexo/source/_posts</code>目录下就可以写我们的博客啦！！！</p>
<p>个人博客效果参考：<a href="https://xiuxiuing.gitee.io/blog/">https://xiuxiuing.gitee.io/blog/</a></p>

      
    </div>

    
      
      

  <div class="post-copyright">
    <p class="copyright-item">
      <span>原文作者: </span>
      <a href="https://xiuxiuing.gitee.io/blog">xiuxiuing</a>
    </p>
    <p class="copyright-item">
      <span>原文链接: </span>
      <a href="https://xiuxiuing.gitee.io/blog/2018/08/08/giteepage/">https://xiuxiuing.gitee.io/blog/2018/08/08/giteepage/</a>
    </p>
    <p class="copyright-item">
      <span>许可协议: </span>
      
      <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/" target="_blank">知识共享署名-非商业性使用 4.0 国际许可协议</a>
    </p>
  </div>



      
      
  <div class="post-reward">
    <input type="checkbox" name="reward" id="reward" hidden />
    <label class="reward-button" for="reward">赞赏支持</label>
    <div class="qr-code">
      
      
        <label class="qr-code-image" for="reward">
          <img class="image" src="http://pd59y0agg.bkt.clouddn.com/%E8%B5%9E%E8%B5%8F.png" title="wechat">
        </label>
      
      
    </div>
  </div>

    

    
      <footer class="post-footer">
        
          <div class="post-tags">
            
              <a href="/blog/tags/Blog/">Blog</a>
            
          </div>
        
        
        
  <nav class="post-nav">
    
      <a class="prev" href="/blog/2018/08/10/blogsetting/">
        <i class="iconfont icon-left"></i>
        <span class="prev-text nav-default">Hexo even主题让博客更优雅</span>
        <span class="prev-text nav-mobile">上一篇</span>
      </a>
    
    
  </nav>

      </footer>
    

  </article>


          </div>
          
  <div class="comments" id="comments">
    
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zOTA3MC8xNTU5Nw==">
        <noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
      </div>  
    
  </div>


        </div>
      </main>

      <footer id="footer" class="footer">

  <div class="social-links">
    
      
        
          <a href="mailto:xiuxiuing@yeah.net" class="iconfont icon-email" title="email"></a>
        
      
    
      
    
      
    
      
    
      
    
      
    
      
        
          <a href="https://gitee.com/xiuxiuing/blog" class="iconfont icon-github" title="github"></a>
        
      
    
      
    
      
    
      
    
      
    
      
    
      
    
    
    
      
      <a href="/blog/atom.xml" class="iconfont icon-rss" title="rss"></a>
    
  </div>


<div class="copyright">
  <span class="power-by">
    由 <a class="hexo-link" href="https://hexo.io/">Hexo</a> 强力驱动
  </span>
  <span class="division">|</span>
  <span class="theme-info">
    主题 - 
    <a class="theme-link" href="https://github.com/ahonn/hexo-theme-even">Even</a>
  </span>

  <span class="copyright-year">
    
    &copy; 
     
      2015 - 
    
    2018

    <span class="heart">
      <i class="iconfont icon-heart"></i>
    </span>
    <span class="author">xiuxiuing</span>
  </span>
</div>

      </footer>

      <div class="back-to-top" id="back-to-top">
        <i class="iconfont icon-up"></i>
      </div>
    </div>

    
  
  

  
   <script type="text/javascript">
	(function(d, s) {
       var j, e = d.getElementsByTagName(s)[0];

       if (typeof LivereTower === 'function') { return; }

       j = d.createElement(s);
       j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
       j.async = true;

       e.parentNode.insertBefore(j, e);
   })(document, 'script');
  </script>




    
  



  
  





  
    <script type="text/javascript" src="/blog/lib/jquery/jquery.min.js"></script>
  

  
    <script type="text/javascript" src="/blog/lib/slideout/slideout.js"></script>
  

  
    <script type="text/javascript" src="/blog/lib/fancybox/jquery.fancybox.pack.js"></script>
  

  
    <script type="text/javascript" src="/blog/lib/pjax/jquery.pjax.min.js"></script>
  

  
    <script type="text/javascript" src="/blog/lib/nprogress/nprogress.min.js"></script>
  


    <script type="text/javascript" src="/blog/js/src/even.js?v=2.9.0"></script>

  </body>
</html>
